package com.naiterui.ehp.bs.patient.vo.doctor;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.naiterui.ehp.bs.patient.utils.ImgUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 义诊医生信息VO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(description = "义诊医生对象")
public class ClinicDoctorVO implements Serializable {

    private static final long serialVersionUID = -6350733306744249728L;
    @JsonInclude(Include.NON_NULL)
    private Long doctorId;

    @ApiModelProperty(value = "医生姓名")
    @JsonInclude(Include.NON_NULL)
    private String name = "";

    @ApiModelProperty(value = "医生头像")
    @JsonInclude(Include.NON_NULL)
    private String photo = "";

    @ApiModelProperty(value = "医生所在科室")
    @JsonInclude(Include.NON_NULL)
    private Integer departmentId;

    @JsonInclude(Include.NON_NULL)
    private String department;

    @ApiModelProperty(value = "医生职称")
    @JsonInclude(Include.NON_NULL)
    private String title = "";

    @ApiModelProperty(value = "医生职称Id")
    @JsonInclude(Include.NON_NULL)
    private Integer titleId;

    @ApiModelProperty(value = "医生所在医院")
    @JsonInclude(Include.NON_NULL)
    private String hospital = "";

    @JsonInclude(Include.NON_NULL)
    private Integer hospitalId;

    @ApiModelProperty(value = "擅长")
    @JsonInclude(Include.NON_NULL)
    private String expertise = "";

    /**
     * 医生认证状态（0：未认证，1：已认证，2：认证未通过，3：再次申请认证，4：未提交资料）
     */
    @JsonInclude(Include.NON_NULL)
    private Integer authStatus;

    @JsonInclude(Include.NON_NULL)
    private String introduction;

    @JsonInclude(Include.NON_NULL)
    private String qrCode;

    /**
     * 与医生关系。-1无关系；0私人医生；1关注医生
     */
    @ApiModelProperty(value = "与医生关系。-1无关系；0私人医生；1关注医生")
    // @JsonInclude(Include.NON_NULL)
    private Integer relation;
    @ApiModelProperty(value = "咨询回复率")
    private String replyRate;
    @ApiModelProperty(value = "平均回复时长")
    private String replyTimeLength;
    @ApiModelProperty(value = "累计服务次数")
    private String serviceNum;
    /**
     * 好评率
     */
    @ApiModelProperty(value = "好评率")
    @JsonInclude(Include.NON_NULL)
    private String praiseRate;

    /**
     * 依据认证状态，设置医生头像： 已认证(1)：正常设置 未认证等(非1)：屏蔽
     *
     * @param photo
     * @param authState
     */
    public void setPhotoOnState(String photo, Integer authState) {
        if (null != authState && authState.equals(1)) {
            this.photo = photo;
        } else {
            this.photo = "";
        }
    }

    public String getPhoto() {
        if (null != authStatus && authStatus.equals(1)) {
            return ImgUtil.getDoctorPhoto(photo == null ? "" : photo);
        } else {
            return "";
        }
    }
}
